import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.IOException;
import java.util.Arrays;
import java.util.Random;

public class 小红的排列生成 {
    public static void main(String[] args) throws IOException {

        for (int ii = 13; ii <= 20; ++ii) {
            Random random = new Random();

            try (BufferedWriter bufferedWriter = new BufferedWriter(new FileWriter("t" + ii + ".in", true));
                 BufferedWriter bufferedWriter1 = new BufferedWriter(new FileWriter("t" + ii + ".out", true))) {

                int n = 100000;
                bufferedWriter.write(n + "\n");

                int[] a = new int[n];
                for (int i = 0; i < n; ++i) {
                    a[i] = random.nextInt(1000000000);
                    bufferedWriter.write(a[i] + " ");
                }

                Arrays.sort(a);
                long ret = 0;
                for (int i = 1; i <= n; ++i) {
                    ret += Math.abs(i - a[i - 1]);
                }
                bufferedWriter1.write(ret + " ");

                // 刷新缓冲区
                bufferedWriter.flush();
                bufferedWriter1.flush();
            }
        }
    }
}
